<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        <mycom></mycom>
    </div>
    <script>
        var com = {
            data() {
                return {}
            },
            methods: {
            },
            template: `<div>我是组件</div>`,
            created() {
                // console.log('这是mixin的创建');

            }

        }
        var mixin = {
            data() {
                return {
                    name: '三胖',
                    obj: {
                        name: 'lisi',
                        sex: '男',
                    }

                }

            },
            methods: {
                abc: function () {
                    console.log('这是mixin的方法');
                    return '再见'
                }

            },
            created() {
                console.log('这是mixin的创建');

            }
        }

        Vue.mixin(mixin)
        var vm = new Vue({
            el: '#app',
            data: {
                name: '三胖',
                obj: {
                    name: 'lisi',
                    age: 12,
                }

            },
            methods: {
                abc: function () {
                    console.log('这是vue的方法');
                    return '你好'
                }

            },
            components: {
                mycom: com

            },
            created() {
                console.log('这是vue的创建');

            }

        })
    </script>
</body>

</html>